<%@ page language="java" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
	  <%@include file="/res/include/base-head.jsp"%>
	  <%@include file="/res/include/jquery-easyui.jsp"%>
	<script type="text/javascript" src="${pageContext.request.contextPath}/res/js/mall/subjectProduct.js"></script>
  </head>
  <body>
	<div class="easyui-layout" data-options="fit:true">
		<div data-options="region:'north',border:false,split:false">
	    	<form id="query-form" class="search_form clearfix">
	    	<input type="hidden" name="subjectId" value="${subjectId}"/>
	            <dl>
					<dt>商品名称：</dt>
					<dd>
						<input name="productName" id="productName" type="text" class="txt" maxlength="32"/>
					</dd>
				</dl>
	            <p class="search_form_btn">
	            	<input type="button" value="搜索" class="icon_serach" onclick="admin.subjectProduct.query()" />
	            	<input type="button" value="添加商品" class="icon_serach" onclick="admin.subjectProduct.select(${subjectId})" />
	            </p>
	        </form>
	  	</div>
	    <div data-options="region:'center',border:false">
		    <table id="datagrid" data-options="url:'${pageContext.request.contextPath}/mall/subject/product/list?subjectId=${subjectId }',toolbar:'#toolbar'">
				<thead>
					<tr>
						<th data-options="field:'productId',width:50,align:'center'">商品id</th>
						<th data-options="field:'productName',width:250,align:'center'">商品名称</th>
						<th data-options="field:'oidx',width:80,align:'center'">排序</th>
						<th data-options="field:'strNewAt',width:150,align:'center'">添加时间</th>
			            <th data-options="field:'id',align:'center',width:200,formatter:formatOperation">操作</th>
					</tr>
				</thead>
			</table>
	  	</div>
	</div>

	<script type="text/javascript">
		function formatStatus(value,row,index) {
			var l_html = '有效';
			if (value==2) {
				l_html = '失效';
			}
			return l_html;
		}
		function formatOperation(value,row,index) {
			var l_html = '';
			l_html += '<a href="javascript:;" class="table_link"  onclick="admin.subjectProduct.edit('+row.id+')">编辑</a>';
			l_html += '<a href="javascript:;" class="table_link"  onclick="admin.subjectProduct.remove('+row.id+')">移除</a>';
			return l_html;
		}
	</script>
  </body>
</html>
